//
// Created by xili on 2024/8/29 10:10.
// GO BIG OR GO HOME.
//
#include "leetcode.h"

class Solution {
public:
    string finalString(string s) {
        string ans = "";
        for (auto &it: s) {
            if (it == 'i') {
                reverse(ans.begin(), ans.end());
            } else {
                ans += it;
            }
        }
        return ans;
    }
};